/*******************************************************************************
 * Copyright (c) 2011 LegSem.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the GNU Public License v3.0
 * which accompanies this distribution, and is available at
 * http://www.gnu.org/licenses/gpl-3.0.txt
 * 
 * Contributors:
 *     LegSem - initial API and implementation
 ******************************************************************************/
package com.legsem.legstar.cci;

import javax.resource.ResourceException;
import javax.resource.cci.ConnectionMetaData;

import com.legsem.legstar.LegStarMetaData;

/**
 * Specific transports provide their version via properties loaded from their
 * classpath.
 * 
 */
public abstract class LegStarConnectionMetaDataImpl extends LegStarMetaData
        implements ConnectionMetaData {

    private static final String EIS_PRODUCT_NAME_KEY = "eis.product.name";
    private static final String EIS_PRODUCT_VERSION_KEY = "eis.product.version";
    private static final String USER_NAME = "Not applicable";

    public LegStarConnectionMetaDataImpl(Class <? extends LegStarMetaData> clazz) {
        super(clazz);
    }

    /**
     * @see ConnectionMetaData#getEISProductName()
     */
    public String getEISProductName() throws ResourceException {

        return getMetadata().getProperty(EIS_PRODUCT_NAME_KEY);
    }

    /**
     * @see ConnectionMetaData#getEISProductVersion()
     */
    public String getEISProductVersion() throws ResourceException {

        return getMetadata().getProperty(EIS_PRODUCT_VERSION_KEY);
    }

    /**
     * @see ConnectionMetaData#getUserName()
     */
    public String getUserName() throws ResourceException {

        return USER_NAME;
    }
}
